package com.zhentao.feign;

import com.zhentao.api.schedule.ScheduleClientApi;
import com.zhentao.model.common.dtos.ResponseResult;
import com.zhentao.model.schedule.dto.TaskDto;
import com.zhentao.service.TaskInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ScheduleClient implements ScheduleClientApi {

    @Autowired
    private TaskInfoService taskInfoService;

    @Override
    public ResponseResult addTask(@RequestBody TaskDto taskDto) {
        return taskInfoService.addTask(taskDto);
    }

    @Override
    public ResponseResult poll(@PathVariable("type") int type) {
        return taskInfoService.submitCurrentPoll(type);
    }
}
